package com.beta.springmvc.integrate;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by yaoyt on 16/12/2.
 *
 * @author yaoyt
 */
@Controller
@RequestMapping("/integrate")
public class UserController {
    @Autowired
    private UserService userService;

    //http://localhost:8080/integrate/user?id=123&name=yaoyt&birth=2016-11-23
    @RequestMapping("/user")
    public String saveUser(@RequestBody @ModelAttribute User u){
        System.out.println(u);
        userService.save();
        return "hello";
    }

}
